package cn.wolfcode.luowowo.search.domain;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

@Document(indexName="luowowo_flight",type="flight")
@Getter
@Setter
public class FlightTemplate implements Serializable{
    public static final String INDEX_NAME = "luowowo_flight";
    public static final String TYPE_NAME = "flight";

    @Id
    @Field(store=true, index = true,type = FieldType.Long)
    private Long id;

    @Field(index=true,store=true,type = FieldType.Keyword)
    private String number;

    //private Boolean issingle;
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String departureCity;
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String destinationCity;
    @Field(pattern = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis", type=FieldType.Date, format = DateFormat.custom)
    private Date departureDate;
    @Field(pattern = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis", type=FieldType.Date, format = DateFormat.custom)

    /*private Date flightStartTime;
    @Field(pattern = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis", type=FieldType.Date, format = DateFormat.custom)
*/
    private Date flightEndTime;
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String startAirport;
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String endAirport;

    //private Boolean isorder;
}
